<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			// Date.parse(str): str必须满足RFC2822或ISO 8601日期格式的字符串
			var timeString = '2023-02-26'

			// 1. 方式一
			var date = new Date(timeString)
			var timestamp = date.getTime()
			console.log('timestamp', timestamp)

			// 2. 方式二:
			var timestamp = Date.parse(timeString)
			console.log('timestamp', timestamp)
		</script>
	</body>
</html>
